﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IGameCollection.cs" company="SingularityShift.com">
//   Copyright (c) 2010 SingularityShift.com. All rights reserved.
// </copyright>
// <author>Ben McClure</author>
// <email>ben@singularityshift.com</email>
// <date>11/30/2010</date>
// <summary>
//   Declares the IGameCollection interface
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace GameLib.Games
{
    #region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using System.Xml.Serialization;

    using GameLib.Games.Util;

    #endregion

    /// <summary>
    /// Interface for a game collection. 
    /// </summary>
    /// <remarks>
    /// Ben McClure, 11/30/2010. 
    /// </remarks>
    public interface IGameCollection : IGameCollection<IGame>
    {
    }

    /// <summary> Interface for game collection</summary>
    /// <typeparam name="T">The type of </typeparam>
    /// <remarks> Ben McClure, 12/3/2010. </remarks>
    public interface IGameCollection<T> : IList<T>, ICloneable
        where T : IGame
    {
        

        #region Properties

        /// <summary> Gets an Array of <see cref="IGame"/> objects in this list. </summary>
        /// <value> An Array of <see cref="IGame">IGames</see>. </value>
        /// <remarks> This is here for serialization only, and should really be removed if a better method is found. </remarks>
        [XmlArray]
        [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
            Justification = "This is used for serialization/deserialiation, since the list can't be serialized properly.")]
        T[] GameArray { get; }

        /// <summary> Gets the <see cref="GameSortTypes"/> enum that defines how this list should be sorted. </summary>
        /// <value> The way the <see cref="IGame"/> objects in the list should be sorted. </value>
        GameSortTypes SortBy { get; }

        #endregion

        #region Public Methods

        ////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary> Removes a game from this collection. </summary>
        /// <param name="thisGame"> The game to remove from the collection. </param>
        void RemoveGame(T thisGame);

        /// <summary> Sorts games using the specified SortType enumeration value. </summary>
        /// <param name="sortBy"> A SortType enumeration indicating how to sort the games. </param>
        void SortGames(GameSortTypes sortBy);

        /// <summary> Returns a new array of <see cref="IGame"/> objects from the <see cref="IGame">IGames</see> in the
        /// list. <see cref="IGame"></see></summary>
        /// <returns> The new array. </returns>
        T[] ToArray();

        #endregion
    }
}